<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>清除浮动</title>
</head>
<style>
    #p1{
        width: 200px;
        height: 200px;
        background: red;
        float: right;
        clear: left;
    }
    #p2{
        width: 200px;
        height: 200px;
        background: yellow;
        float: right;

    }
    #p3{
        width: 200px;
        height: 200px;
        background: blue;
        float: right;
       
    }
    #p4{
        width: 200px;
        height: 200px;
        background: green;
    }

</style>
<body>
<div id="p1"></div>
<div id="p2"></div>
<div id="p3"></div>
<div id="p4"></div>
</body>
</html>